package com.example.mvvm

import android.app.Application
import android.util.Log
import com.atom.module.mvvm.base.AbstractApplication
import com.atom.module.utils.Logs
import timber.log.Timber

class App : AbstractApplication() {

    override fun initApplication(): Application {
        return this
    }

    override fun onCreate() {
        super.onCreate()
        Timber.plant(Timber.DebugTree())
        Logs.init(this.applicationInfo.name)
    }

    class CrashReportingTree : Timber.Tree() {
        override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
            if (priority == Log.VERBOSE || priority == Log.DEBUG) {
                return;
            }
            //FakeCrashLibrary.log(priority, tag, message);
            if (t != null) {
                if (priority == Log.ERROR) {
                    //FakeCrashLibrary.logError(t);
                } else if (priority == Log.WARN) {
                    // FakeCrashLibrary.logWarning(t);
                } else {

                }
            }
        }

    }

}